package ch.exm.storm.test.domain.impl;

import ch.exm.storm.test.domain.Item;
import ch.exm.storm.test.domain.Order;
import ch.exm.storm.test.domain.OrderedItem;

public class OrderedItemImpl extends AbstractDomainObject implements OrderedItem {

	private Item item;
	
	private int quantity;
	
	private Order order;
	
	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	
	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	public double getValue() {
		return quantity * item.getPrice();
	}
	
	@Override
	public String toString() {
		return "OrderedItem[" + getId() + "] with value = " + getValue();
	}
}
